package com.neulogistics.core.customercenter.api.application.command;

import com.blackto.lib.mediat.unicast.IRequest;
import com.neulogistics.core.customercenter.api.application.validator.annotation.ValidateAddress;
import com.neulogistics.core.customercenter.domain.model.valueobject.Address;
import com.neulogistics.infrastructure.common.serviceresult.BaseResponse;
import lombok.Data;

import javax.validation.constraints.*;
import java.io.Serializable;

@Data
public class CreateCustomerCommand implements IRequest<BaseResponse<String>>, Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 客户名
     */
    @NotBlank(message = "用户名不能为空！")
    @Size(max = 10, message = "客户名不能超过10！")
    private String customerName;

    /**
     * 单位名
     */
    @Size(max = 50, message = "单位名不能超过50！")
    private String flatsName;

    /**
     * 身份证号
     */
    @NotBlank(message = "客户身份证号不能为空！")
    @Pattern(regexp = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$",
                message = "错误的身份证号！")
    private String customerIdentity;

    /**
     * 客户电话
     */
    @NotBlank(message = "客户电话号不能为空！")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "错误的手机号！")
    private String customerPhone;

    /**
     * 收货地址
     */
    @NotNull
    @ValidateAddress
    private Address receiverAddress;

    /**
     * 邮件地址
     */
    @Email(message = "错误的邮件地址！")
    private String customerEmail;

    /**
     * 座机号
     */
    @NotBlank
    private String customerLandline;

}
